package com.eies.common;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class LogWritter {
	
	public static void debug(String message, Class curClass)
	  {
	    if (curClass != null) {
	      Log logger = LogFactory.getLog(curClass);
	      if (logger.isDebugEnabled())
	        logger.debug(message);
	    }
	  }

	  public static void debug(String message, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isDebugEnabled())
	        logger.debug(message);
	    }
	  }

	  public static void debug(String message, Throwable ex, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isDebugEnabled())
	        logger.debug(message, ex);
	    }
	  }

	  public static void debug(String message, Throwable ex, Class curClass)
	  {
	    if (curClass != null) {
	    	Log logger = LogFactory.getLog(curClass);
	      if (logger.isDebugEnabled())
	        logger.debug(message, ex);
	    }
	  }

	  public static void info(String message, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isInfoEnabled())
	        logger.info(message);
	    }
	  }

	  public static void info(String message, Class curClass)
	  {
	    if (curClass != null) {
	    	Log logger = LogFactory.getLog(curClass);
	      if (logger.isInfoEnabled())
	        logger.info(message + "   in class : " + curClass.getName());
	    }
	  }

	  public static void info(String message, Throwable ex, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isInfoEnabled())
	        logger.info(message, ex);
	    }
	  }

	  public static void info(String message, Throwable ex, Class curClass)
	  {
	    if (curClass != null) {
	    	Log logger = LogFactory.getLog(curClass);
	      if (logger.isInfoEnabled())
	        logger.info(message + "   in class : " + curClass.getName(), ex);
	    }
	  }

	  public static void warn(String message, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isWarnEnabled())
	        logger.warn(message);
	    }
	  }

	  public static void warn(String message, Class curClass)
	  {
	    if (curClass != null) {
	    	Log logger = LogFactory.getLog(curClass);
	      if (logger.isWarnEnabled())
	        logger.warn(message);
	    }
	  }

	  public static void warn(String message, Throwable ex, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isWarnEnabled())
	        logger.warn(message, ex);
	    }
	  }

	  public static void warn(String message, Throwable ex, Class curClass)
	  {
	    if (curClass != null) {
	    	Log logger = LogFactory.getLog(curClass);
	      if (logger.isWarnEnabled())
	        logger.warn(message, ex);
	    }
	  }

	  public static void error(String message, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	    	Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isErrorEnabled())
	        logger.error(message);
	    }
	  }

	  public static void error(String message, Class curClass)
	  {
	    if (curClass != null) {
	      Log logger = LogFactory.getLog(curClass);
	      if (logger.isErrorEnabled())
	        logger.error(message);
	    }
	  }

	  public static void error(String message, Throwable ex, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	      Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isErrorEnabled())
	        logger.error(message, ex);
	    }
	  }

	  public static void error(String message, Throwable ex, Class curClass)
	  {
	    if (curClass != null) {
	      Log logger = LogFactory.getLog(curClass);
	      if (logger.isErrorEnabled())
	        logger.error(message, ex);
	    }
	  }

	  public static void fatal(String message, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	      Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isFatalEnabled())
	        logger.fatal(message);
	    }
	  }

	  public static void fatal(String message, Class curClass)
	  {
	    if (curClass != null) {
	      Log logger = LogFactory.getLog(curClass);
	      if (logger.isFatalEnabled())
	        logger.fatal(message);
	    }
	  }

	  public static void fatal(String message, Throwable ex, String loggerName)
	  {
	    if ((loggerName != null) && (!"".equals(loggerName.trim()))) {
	      Log logger = LogFactory.getLog(loggerName.trim());
	      if (logger.isFatalEnabled())
	        logger.fatal(message, ex);
	    }
	  }

	  public static void fatal(String message, Throwable ex, Class curClass)
	  {
	    if (curClass != null) {
	      Log logger = LogFactory.getLog(curClass);
	      if (logger.isFatalEnabled())
	        logger.fatal(message, ex);
	    }
	  }

}
